/*****************************************************************************
Copyright 2006 Kervin L. Pierre
    EMAIL: otlkcon@adevsoft.com

This file is part of Otlkcon.

Otlkcon is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

Otlkcon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Lesser GNU General Public License for more details.

You should have received a copy of the Lesser GNU General Public License
along with Otlkcon; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*******************************************************************************/


#pragma once

#include <windows.h>
#include <mapi.h>
#include <mapiutil.h>
#include <mapispi.h>

#include <otlkcon_print.h>
#include <otlkcon_config.h>
#include <otlkcon_registry.h>
#include <otlkcon_account.h>

#include <vector>
#include <map>
#include <algorithm>

using namespace std;

INT_PTR CALLBACK otlkcon_sheet1DlgProc(HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam );
INT_PTR CALLBACK otlkcon_sheet2DlgProc(HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam );
INT_PTR CALLBACK otlkcon_sheet3DlgProc(HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam );
INT_PTR CALLBACK otlkcon_sheet3bDlgProc(HWND hwnd, UINT uMsg, WPARAM wparam, LPARAM lparam );

UINT CALLBACK otlkcon_sheetCallback( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );

class otlkcon_config
{
    private:
    public:
        otlkcon_config();
        otlkcon_config(HWND ui, otlkcon_memory *m );

        STDMETHODIMP showGui();
        STDMETHODIMP clear();
        STDMETHODIMP readRegistry();
        STDMETHODIMP writeRegistry();

        otlkcon_memory *memObj;

        HWND ulUIParam;
        bool isDirty;

        wstring registryRoot;

        // Config parameters
        wstring dbFilename;
        //TODO: Protect this memory.
        wstring pass;  
        unsigned short    xpEnabled;
        unsigned short    abEnabled;
        unsigned short    useMasterPassword;

        unsigned short    debugFileEnabled;
        unsigned short    debugSMEnabled;
        unsigned short    debugDBEnabled;
        wstring debugLogFilename;
        int     debugLevel;

        map<wstring,wstring> accountIdChanges;
        vector<otlkcon_account_details *> accounts;
        map<int, wstring> accTypeList;

        int lastAccountComboIndex;
};
